HTML is a language that specifies how a document looks. Call it a tag or markup language. The format of the document is changed by adding a tag to it which specifies exactly how you want the text to look. HTML tags are phrases that begin with an opening bracket < and end with a closing bracket > A tag is nothing more than a command you give the Web browser (ie: Netscape or IE) that it will perform before it continues looking at the rest of the HTML file.
Container tags define a section of text (or of the document itself) and specify the formatting or construction for all the selected text. You mark the beginning of the content with a tag <B>and you mark the ending of content with the corresponding closing tag </B>. Most containers can overlap and hold other containers or empty tags. Look at the follow example of using container tags within container tags.
This <B>sentence <I> contains</I> a bolded</B> phrase and an <I>italicized </I>word.(see an example)
View a list of Container Tags
Many HTML tags also accept parameters called attributes. Attributes are used to provide additional information to the Web browser about how you want to apply a tag.
Each file begins with the <HTML> tag and ends with the closing </HTML> tag. This tag is necessary. Inside the <HTML> container, their are two additional tags <HEAD> and <BODY>.
The <HEAD> container specifies title information for the Web page. Within the <HEAD> container there is one more container, <TITLE> </TITLE> that specifies the title of the Web page as the user sees it in the browser's title bar. </HEAD>
The <BODY> contains the actual contents of the Web page. </BODY>
Sample code for a webpage: (referenced on pp 527-528 of text, Listing 28.1)
<HTML>
<HEAD>
<TITLE>An Example of a Complete HTML File</TITLE>
</HEAD>
<BODY>
The Actual content of the Web page goes in this container
</BODY>
</HTML>
Every HTML document needs a title. This is how it is typed:
<title>My first HTML document</title>
The title text is preceded by the start tag <title> and ends with the matching end tag </title>. The title should be placed at the beginning of your document.
In HTML there are six levels of headings. H1 is the most important, H2 is slightly less important, and so on down to H6, the least important.
Each paragraph you write should start with a <p> tag. The </p> is optional, unlike the end tags for elements like headings. For example:
<p>This is the first paragraph.</p> <p>This is the second paragraph.</p>
You can emphasise one or more words with the <em> tag, for instance:
This is a really <em>interesting</em> topic!
HTML supports three types of lists. The first is a bulletted list, often called an unordered list. It uses the <ul> and <li> tags, for instance:
<ul> <li>the first list item</li> <li>the second list item</li> <li>the third list item</li> </ul>
Note: that you always need to end the list with the </ul> end tag, but that the </li> is optional and can be left off.
The second kind of list is a numbered list, often called an ordered list. It uses the <ol> and <li> tags. For instance:
<ol> <li>the first list item</li> <li>the second list item</li> <li>the third list item</li> </ol>
Like bulletted lists, you always need to end the list with the </ol> end tag, but the </li> end tag is optional and can be left off.
The third and final kind of list is the definition list. This allows you to list terms and their definitions. This kind of list starts with a <dl> tag and ends with </dl> Each term starts with a <dt> tag and each definition starts with a <dd>. For instance:
<dl> <dt>the first term</dt> <dd>its definition</dd> <dt>the second term</dt> <dd>its definition</dd> <dt>the third term</dt> <dd>its definition</dd> </dl>
The end tags </dt> and </dd> are optional and can be left off.
Note that lists can be nested, one within another. For instance:
nested list
<ol>
<li>the first list item</li>
<li>the second list item</li>
<ul>
<li>first nested item</li>
<li>second nested item</li>
</ul>
<li>the third list item</li>
</ol>
You can also make use of paragraphs and headings etc. for longer list items.